package hmis.pos.Entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import hmis.pos.Base.BaseEntity.BaseEntity;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name="roomprice",uniqueConstraints = {
        @UniqueConstraint(columnNames = {"type","date"})
})
public class RoomPrice extends BaseEntity {

    /*//一个房间类型对应多个价格(不同日期不同价格)
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name="type",referencedColumnName = "type",insertable = false,updatable = false)
    private RoomType roomType;*/

    //房间类型
    @Column(name="type",nullable = false)
    private String type;

    //日期
    @Column(name="date",nullable = false)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date date;

    //价格
    @Column(name="price",nullable = false)
    private double price;

    //剩余可预定数
    @Column(name="surplus",nullable = false)
    private int surplus;

    //已经预定的数量
    @Column(name="reservationcount",nullable = false)
    private int reservationcount;


    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getSurplus() {
        return surplus;
    }

    public void setSurplus(int surplus) {
        this.surplus = surplus;
    }

    public int getReservationcount() {
        return reservationcount;
    }

    public void setReservationcount(int reservationcount) {
        this.reservationcount = reservationcount;
    }


    @Override
    public String toString() {
        return "RoomPrice{" +
                ", type='" + type + '\'' +
                ", date=" + date +
                ", price=" + price +
                ", surplus=" + surplus +
                ", reservationcount=" + reservationcount +
                '}';
    }
}
